import { FlowRouter } from 'meteor/kadira:flow-router';
import { BlazeLayout } from 'meteor/kadira:blaze-layout';

// Import needed templates
import '../../ui/layouts/body/body.js';
import '../../ui/pages/home/home.js';
import '../../ui/pages/ontime/ontime.js';
import '../../ui/pages/dashboard/dashboard.js';
import '../../ui/pages/login/login.js';
import '../../ui/pages/not-found/not-found.js';
import '../../ui/pages/my/my.js';
import '../../ui/pages/arrangements/arrangements.js';

// Set up all routes in the app
FlowRouter.route('/', {
  name: 'App.home',
  action() {
    BlazeLayout.render('App_body', { main: 'App_home' });
  },
});
FlowRouter.route('/my/:username', {
  name: 'App.my',
  subscriptions: function(params, queryParams) {
      this.register('userpage', Meteor.subscribe('user.username', params.username));
  },
  action() {

      BlazeLayout.render('App_body', { main: 'App_my' });
  },
});
FlowRouter.route('/dashboard', {
  name: 'App.home',
  action() {
    BlazeLayout.render('App_body', { main: 'dashboard' });
  },
});
FlowRouter.route('/ontime', {
  name: 'App.home',
  action() {
    BlazeLayout.render('App_body', { main: 'ontime' });
  },
});
FlowRouter.route('/arrangements', {
  name: 'App.home',
  action() {
    BlazeLayout.render('App_body', { main: 'arrangements' });
  },
});
FlowRouter.route('/login', {
  name: 'App.home',
  action() {
    BlazeLayout.render('App_body', { main: 'App_login' });
  },
});

FlowRouter.notFound = {
  action() {
    BlazeLayout.render('App_body', { main: 'App_notFound' });
  },
};
